package com.sc.nft.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.UserEquityPropsLog;
import com.sc.nft.entity.vo.EquityPropsGetLogPageVO;
import com.sc.nft.entity.vo.EquityPropsUseLogPageVO;
import com.sc.nft.entity.vo.MallEquityPropsGetLogPageVO;
import com.sc.nft.entity.vo.PageEquityPropsLogVO;
import com.sc.nft.enums.UserEquityPropsGetTypeEnum;
import com.sc.nft.enums.UserEquityPropsUseTypeEnum;
import com.sc.nft.mapper.UserEquityPropsLogMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 权益道具记录表(sc_user_equity_props_log)数据DAO
 *
 * @author Sun
 * @description 由 Mybatisplus Code Generator 创建
 * @since 2023-03-28 10:28:52
 */
@Slf4j
@Repository
public class UserEquityPropsLogDao extends ServiceImpl<UserEquityPropsLogMapper, UserEquityPropsLog> {

    public Boolean insertBatchByList(ArrayList<UserEquityPropsLog> userEquityPropsLogArrayList) {
        return this.saveBatch(userEquityPropsLogArrayList);
    }

    public Page<PageEquityPropsLogVO> getPageEquityPropsLog(Page page, Integer isConsume, Long userId) {
        return baseMapper.getPageEquityPropsLog(page, isConsume, userId);
    }

    public Page<EquityPropsGetLogPageVO> getLog(Long propId, Long userId, String firstTitle, UserEquityPropsGetTypeEnum getType, Date startTime, Date endTime, Integer pageNo, Integer pageSize) {
        return baseMapper.getLog(new Page<>(pageNo, pageSize), propId, userId, firstTitle, getType, startTime, endTime);
    }

    public Page<EquityPropsUseLogPageVO> useLog(Long userId, String firstTitle, UserEquityPropsUseTypeEnum useType, Date startTime, Date endTime, Integer pageNo, Integer pageSize) {
        return baseMapper.useLog(new Page<>(pageNo, pageSize), userId, firstTitle, useType, startTime, endTime);
    }

    public Page<MallEquityPropsGetLogPageVO> mallPropsGetLog(Long userId, UserEquityPropsGetTypeEnum getType, Integer pageNo, Integer pageSize) {
        return baseMapper.mallPropsGetLog(new Page<>(pageNo, pageSize), userId, getType.getCode());
    }

    public List<UserEquityPropsLog> selectByLastMinId(Long lastMinId, Integer pageSize) {
        return baseMapper.selectByLastMinId(lastMinId, pageSize);
    }


}